<?php
/**
 * Application bootstrap
 * 
 */
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	/**
	 * Init view
	 * 
	 * @return Zend_View
	 */
    protected function _initView()
    {
        // Initialize view
        $view = new Zend_View();
        $view->doctype('XHTML1_STRICT');
        $view->setEncoding('utf-8');
        $view->strictVars();
        $view->headTitle('My test application')->setSeparator(' :: ');
        
        // Add it to the ViewRenderer
        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
            'ViewRenderer'
        );
        $viewRenderer->setView($view);

        // Return it, so that it can be stored by the bootstrap
        return $view;
    }

    protected function _initRouting()
    {
        $this->bootstrap('FrontController');
        $router = $this->getResource('FrontController')->getRouter();

        $router->addRoute('student', new Zend_Controller_Router_Route('/pages/student/:studentId', array('module' => 'pages', 'controller' => 'student', 'action' => 'index')));

        $router->addRoute('student_login', new Zend_Controller_Router_Route('/pages/student/login', array('module' => 'pages', 'controller' => 'student', 'action' => 'login')));

        $router->addRoute('student_view', new Zend_Controller_Router_Route('/pages/student/:studentId/view', array('module' => 'pages', 'controller' => 'student', 'action' => 'view')));

        $router->addRoute('student_choose', new Zend_Controller_Router_Route('/pages/student/choose/:studentId', array('module' => 'pages', 'controller' => 'student', 'action' => 'choose')));

        $router->addRoute('student_choose_task', new Zend_Controller_Router_Route('/pages/student/choose/:studentId/:taskId', array('module' => 'pages', 'controller' => 'student', 'action' => 'choose')));

        $router->addRoute('instructor', new Zend_Controller_Router_Route('/pages/instructor/:instId', array('module' => 'pages', 'controller' => 'instructor', 'action' => 'index')));

        $router->addRoute('instructor_year', new Zend_Controller_Router_Route('/pages/instructor/:instId/:instYear', array('module' => 'pages', 'controller' => 'instructor', 'action' => 'index')));

        $router->addRoute('viewgroup',new Zend_Controller_Router_Route('/pages/instructor/:instId/group/:groupId', array('module' => 'pages', 'controller' => 'instructor', 'action' => 'group')));

        $router->addRoute('viewstudent',new Zend_Controller_Router_Route('/pages/instructor/:instId/student/:studentId', array('module' => 'pages', 'controller' => 'instructor', 'action' => 'studentview')));

        $router->addRoute('choosestudent',new Zend_Controller_Router_Route('/pages/instructor/:instId/studtask/:studentId', array('module' => 'pages', 'controller' => 'instructor', 'action' => 'studentchoose')));

        $router->addRoute('choosestudenttask',new Zend_Controller_Router_Route('/pages/instructor/:instId/studtask/:studentId/:taskId', array('module' => 'pages', 'controller' => 'instructor', 'action' => 'studentchoose')));

        $router->addRoute('loginInst', new Zend_Controller_Router_Route('/pages/instructor/login', array('module' => 'pages', 'controller' => 'instructor', 'action' => 'login')));

        $router->addRoute('logoutInst', new Zend_Controller_Router_Route('/pages/instructor/logout', array('module' => 'pages', 'controller' => 'instructor', 'action' => 'logout')));

	return $router;
    }
}